package com.wangbo.observer;

/**
 * 观察者模式
 */
public class Client {
    public static void main(String[] args) {
        Subject subject = new Subject();

        BinaryObserver binaryObserver = new BinaryObserver(subject);
        HexObserver hexObserver = new HexObserver(subject);

        /**
         * Set state=15
         * Binary String: 1111
         * Hex String: f
         * Set state=20
         * Binary String: 10100
         * Hex String: 14
         */
        System.out.println("Set state=15");
        subject.setState(15);
        System.out.println("Set state=20");
        subject.setState(20);
    }
}
